AngouriMath

Navigation

SparseTerms`1


← Back to list of classes

Description

Summary

A finitely-supported map from a basis into a coefficient semiring -- the shape shared by
a polynomial, an asymptotic series, a boolean expression's minterms and a quantum state.

Type parameter "TBasis"

The basis element. An exponent vector, a rational exponent, a basis ket.
**It must compare by value.** The terms are keyed on it, so a basis with reference
equality would leave every element distinct and quietly stop collecting like terms --
which is not an error anywhere, just a wrong answer. Use a struct or a record.

Remarks

Immutable by construction: every operation returns a new instance, and the dictionary
handed in is copied rather than adopted. It is not
System.Collections.Immutable because that would be a new package reference on a
library that has none, which is a packaging decision rather than a design one.
The invariant is that **no term carries a zero coefficient**. That is what makes the
count of terms meaningful, and it is where an idempotent semiring quietly pays for
itself: adding a boolean term to itself collapses to one term by
Add(AngouriMath.Entity,AngouriMath.Entity) alone, so absorption needs no special case here.
See *One structure under several features* in AGENTS.md for what this is for and,
as importantly, what must not be built on it -- cover selection, factorisation into
irreducibles and series truncation are each specific to one feature and belong in it.

Members

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online